package xs.szw.service.converter;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import xs.szw.common.model.Option;
import xs.szw.service.model.pojo.sys.Role;

import java.util.List;

/**
 * @program: xs_oa
 * @description:  角色对象转换器
 * @author: Songzw
 * @create: 2025-02-26 16:42
 **/
@Mapper(componentModel = "spring")
public interface RoleConverter {

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "name")
    })
    Option<Long> roleToOption(Role role);

    List<Option<Long>> roleListToOptionList(List<Role> roles);
}
